<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>商品分类编辑</title>
<link href="<%=basePath%>skin/css/validform/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/validform/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/common.js"></script>
<script language="javascript">
	$().ready(function(){
		//验证
		var validform = $("#form1").Validform({
			btnSubmit:"#save",
			tiptype:3
		});
		validform.addRule([
			{
			    ele:"#name",
			    datatype:"*",
			    nullmsg:"请输入名称！"
			},
			{
			    ele:"#orders",
			    datatype:"n",
			    nullmsg:"请输入排序！"
			}
		]);
	 });
</script>
</head>

<body>
	<form id="form1" name="form1" method="post" action="<%=basePath%>admin/productCategory/update.shtml" enctype="multipart/form-data">
		<input type="hidden" name="id" value="${category.id}" />
		<table width="98%" class="input tabContent">
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">图片：</td>
				<td class="tdLeft">
					<input type="file" name="file" id="file"/>
				</td>
			</tr>
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">名称：</td>
				<td class="tdLeft"><input id="name" name="name"
					size="30" class="input" value="${category.name}"/></td>
			</tr>
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">上级分类：</td>
				<td class="tdLeft">
					<select name="parentId">
						<option value=""<c:if test="${category.grade == 0 }">selected</c:if>>顶级分类</option>
						<c:forEach items="${productCategoryTree }" var="productCategory">
							<c:if test="${productCategory.id != category.id}">
								<option value="${productCategory.id }" <c:if test="${category.parent.id == productCategory.id }">selected</c:if>>
									<c:if test="${productCategory.grade != 0 }">
										<c:forEach varStatus="i" begin="0" end="${productCategory.grade}">
											&nbsp;&nbsp;
										</c:forEach>
									</c:if>
									${productCategory.name }
								</option>
							</c:if>
						</c:forEach>
					</select>
				</td>
			</tr>
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">页面标题：</td>
				<td class="tdLeft"><input id="seoTitle" name="seoTitle"
					size="30" class="input" value="${category.seoTitle}"/></td>
			</tr>
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">页面关键词：</td>
				<td class="tdLeft"><input id="seoKeywords" name="seoKeywords"
					size="30" class="input" value="${category.seoKeywords}"/></td>
			</tr>
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">页面描述：</td>
				<td class="tdLeft"><input id="seoDescription" name="seoDescription"
					size="30" class="input" value="${category.seoDescription}"/></td>
			</tr>
			<tr bgcolor="#FAFAF1" height="22">
				<td class="tdRight">排序：</td>
				<td class="tdLeft"><input id="orders" name="orders"
					size="30" class="input" value="${category.orders}"/></td>
			</tr>
		</table>
		<table width="98%">
			<tr bgcolor="#EEF4EA">
				<td height="36" colspan="10">
					<input type="button" value="确定" class="button" id="save" />
					<input type="button" value="返回" class="button" onclick="location.href='<%=basePath%>admin/productCategory/list.shtml'" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
